﻿using Knlght.Domain;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Knight.Models.Entity
{
    public class RoleInfo:TEntityBase
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Remark { get; set; }
        public string Jurisdiction { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnabled { get; set; }
        public DateTime AddTime { get; set; }
    }

    public class RoleInfoMapping : EntityTypeConfiguration<RoleInfo>
    {
        public RoleInfoMapping()
        {
            // 设置表名
            this.ToTable("T" + nameof(RoleInfo));
            //设置主键
            this.HasKey(a => a.Id);
            //不更新
            this.Property(t => t.AddTime).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
            // 设置属性的类型和长度
            this.Property(a => a.Name).HasColumnType("NVarchar").HasMaxLength(200);
        }
    }
}

